﻿using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public class PressTrigger : MonoBehaviour
{
    public GameObject contrelCenter;
    float timer = 0f;
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        if (timer > 3f)
        {
            GetComponent<Animator>().SetBool("Press", true);
            contrelCenter.GetComponent<Room1_Contrel>().addPressObj(transform.gameObject);
            GetComponent<BoxCollider>().enabled = false;
            timer = 0;
        }
    }

    private void OnTriggerStay(Collider other)
    {
        if(other.tag.Equals("Player"))
        {
            timer += Time.deltaTime;
        }
    }
}
